//data
export function buildTableData(data) {
  return Object.assign({
    // 表头
    columns: [
      {
        title: '序号',
        dataIndex: '',
        key:'rowIndex',
        width:60,
        align:"center",
        fixed: "left",
        // customRender: (text, record, index) =>
        //   `${(this.ipagination.current - 1) * this.ipagination.pageSize + index + 1}`
        // customRender:function (t,r,index) {
        //   return parseInt(index)+1;
        // }
      },
      {
        title:'付款编号',
        align:"center",
        dataIndex: 'payablesNo'
      },
      {
        title:'合同信息',
        align:"center",
        dataIndex: 'leaseContractId_dictText'
      },
      {
        title:'资产信息',
        align:"center",
        dataIndex: 'assetId_dictText'
      },
      {
        title: '资产明细',
        align: 'center',
        // fixed:"left",
        // width: 200,
        dataIndex: 'assetSubIds_dictText'
      },
      {
        title:'客户信息',
        align:"center",
        dataIndex: 'customerId_dictText'
      },
      {
        title:'应付金额',
        align:"center",
        dataIndex: 'totalMoney',
        customRender: function (text) {
          if (!text) {
            text = 0
          }
          return text.toLocaleString("zh-Hans-CN",{style:"currency",currency:"CNY"});
        }
      },
      {
        title:'付款状态',
        align:"center",
        dataIndex: 'payStatus_dictText'
      },
      {
        title:'付款方式',
        align:"center",
        dataIndex: 'paymentType_dictText'
      },
      {
        title:'付款日期',
        align:"center",
        dataIndex: 'paymentDate',
        customRender:function (text) {
          return !text?"":(text.length>10?text.substr(0,10):text)
        }
      },
      {
        title:'付款人',
        align:"center",
        dataIndex: 'paymentBy_dictText'
      },
      {
        title:'付款说明',
        align:"center",
        dataIndex: 'paymentRemark'
      },
      {
        title:'备注',
        align:"center",
        dataIndex: 'remark'
      },
      // {
      //   title:'更新人',
      //   align:"center",
      //   dataIndex: 'updateBy'
      // },
      // {
      //   title:'更新日期',
      //   align:"center",
      //   dataIndex: 'updateTime',
      //   customRender:function (text) {
      //     return !text?"":(text.length>10?text.substr(0,10):text)
      //   }
      // },
      // {
      //   title:'创建人',
      //   align:"center",
      //   dataIndex: 'createBy'
      // },
      // {
      //   title:'创建日期',
      //   align:"center",
      //   dataIndex: 'createTime',
      //   customRender:function (text) {
      //     return !text?"":(text.length>10?text.substr(0,10):text)
      //   }
      // },
      {
        title: '操作',
        dataIndex: 'action',
        align:"center",
        fixed:"right",
        width: 190,
        scopedSlots: { customRender: 'action' },
      }
    ],
    url: {
      list: "/zcgl/payablesInfo/list",
      delete: "/zcgl/payablesInfo/delete",
      deleteBatch: "/zcgl/payablesInfo/deleteBatch",
      exportXlsUrl: "/zcgl/payablesInfo/exportXls",
      importExcelUrl: "zcgl/payablesInfo/importExcel",
      exportXlsTemplate: 'zcgl/payablesInfo/exportXlsTemplate'
    },
    dictOptions:{},
  }, data)
}

//methods
export function buildTableMethod( otherMethods) {
  return Object.assign({

    initDictConfig(){
      this.toTop = 485
      let height = window.innerHeight - this.toTop
      if (height < 300){
        height = 300
      }
      this.screenHeight = height
    },
    handleOperation (title, record, type) {
      this.$refs.modalOperationForm.show(title, record, type);
    },
    modalOperationOk(){
      this.loadData()
    }
  }, otherMethods)
}